/// <reference path="../Scripts/jquery-1.7.1.min.js" />
/// <reference path="../Scripts/knockout-2.1.0.js" />

jQuery(document).ready(function () {
    //var MyRegisterViewModel = new RegisterViewModel();

    var mainDiv = document.getElementById('Main');
    var MyRegisterViewModel = new RegisterViewModel();
    ko.applyBindings(MyRegisterViewModel, mainDiv);
    //MyRegisterViewModel.GetPasswordQuestions();
    MyRegisterViewModel.getPassQs();
    //ko.applyBindings(MyRegisterViewModel, document.getElementById('Main'));
    //MyRegisterViewModel.GetPasswordQuestions();




    jQuery("#NewRegisterForm").validate({
		submitHandler: function (form) {
            MyRegisterViewModel.Register();
        },
		 rules: {
            UserName: {
                required: true,
                minlength: 5,
                maxlength: 100
            },
            Password: {
                required: true,
                minlength: 5,
                maxlength: 50

            },
            ConfirmPassword: {
                equalTo: "#Password"
                
            },
            Email: {
                required: true,
                email: true
            },
            OfficePhone: {
                required: true
            },
            CellPhone: {
                    required: true
            },
            Address: {
                required: true
               
            },
            City: {
                required: true

            },
            Region: {
                required: true

            },
            PostalCode: {
                required: true

            },
            PasswordQuestion: {
                required: true

            },
            PasswordAnswer: {
                required: true

            },
            LastName: {
                required: true
            },
            FirstName: {
                required: true
            },
            Title: {
                required: true
            }
        },
        messages: {
            ConfirmPassword: {
                equalTo: "This must be the same as the password field"
                
            }
        }
    });

    

    
});